<script setup>
import { useCounterStore } from "./stores/counter";
import { useTodoStore } from "./stores/todo";
import { storeToRefs } from "./pinia";

const store = useCounterStore();
const todoStore = useTodoStore();
const {todo, todos} = storeToRefs(todoStore);
const {addTodo} = todoStore;
</script>

<template>
  {{ store.count }}
  {{ store.doubleCount }}
  <button @click="store.increment">Increment</button>
  <button @click="store.decrement">Decrement</button>
  <button @click="store.$reset()">reset</button>

  <input type="text" v-model="todo"/>
  <li v-for="todo of todos">{{ todo }}</li>
  <button @click="addTodo()">添加</button>
</template>

<style scoped>
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}

.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
